﻿using System;
using Chip8.Core.Bus;

namespace Chip8.Core.Processor.Operations
{
	internal class SKP : Operation
	{
		public SKP(int registerIndex)
		{
			RegisterIndex = registerIndex;
		}

		public int RegisterIndex { get; set; }

		public override void Execute(ICPU cpu)
		{
			int keyIndex = cpu.V[RegisterIndex];
			if (cpu.Bus.KeyPad.CheckKey(keyIndex))
			{
				cpu.PC += Chip8.OpcodeSize;
			}
		}
	}
}